import re


def query_order_system(order_query: str) -> str:
    """模拟查询订单系统"""
    # 提取订单号
    order_match = re.search(r'订单[号]?[:：]?\s*([A-Z]{2}\d{9})', order_query)
    if not order_match:
        return "未识别到有效订单号"

    order_id = order_match.group(1)

    # 模拟订单数据
    order_data = {
        "AB123456789": {
            "status": "已发货",
            "products": ["XY-200手机(黑色)", "Type-C充电器"],
            "total": 3069.00,
            "shipping": {
                "address": "上海市浦东新区张江路123号",
                "courier": "顺丰快递",
                "tracking": "SF1234567890"
            }
        },
        "CD987654321": {
            "status": "待付款",
            "products": ["智能手表Pro", "保护套"],
            "total": 899.00,
            "shipping": None
        }
    }

    # 返回订单信息
    if order_id in order_data:
        order = order_data[order_id]
        return (
            f"订单号: {order_id}\n"
            f"状态: {order['status']}\n"
            f"商品: {', '.join(order['products'])}\n"
            f"总额: ¥{order['total']}"
        )
    else:
        return f"未找到订单{order_id}的信息"


def calculate_shipping(address: str) -> str:
    """计算运费"""
    # 简化运费规则
    if "上海" in address or "江苏" in address or "浙江" in address:
        return "运费: ¥6"
    elif "新疆" in address or "西藏" in address:
        return "运费: ¥25"
    else:
        return "运费: ¥15"